//
//  SplashViewController.m
//  sign Detector
//
//  Created by Thanh Hai on 4/3/13.
//  Copyright (c) 2013 Thoi Thai. All rights reserved.
//

#import "SplashViewController.h"
#import "DataCenter.h"
#import "SettingViewController.h"
#import "DetectorViewController.h"

static SplashViewController *_Share = nil;

@interface SplashViewController ()

@end

@implementation SplashViewController

+ (SplashViewController*)shared{
    @synchronized([SplashViewController class]){
        if (!_Share) {
            _Share = [[SplashViewController alloc] initWithNibName:@"SplashViewController" bundle:[NSBundle mainBundle]];
        }
        
        return _Share;
    }
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    double delayInSeconds = 2.0;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        if (![[DataCenter shared] standardImageSign]) {
            [self.navigationController pushViewController:[SettingViewController shared] animated:YES];
        }else{
            [self.navigationController pushViewController:[DetectorViewController shared] animated:YES];
        }
    });
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
